<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0" />
    <meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
    <title>我的订单</title>
    <link rel="stylesheet" href="../../../css/aui.css" />
    <link rel="stylesheet" href="../../../css/iconfont/iconfont.css" />
    <link rel="stylesheet" href="../../../script/widget/Zepto/dropload.css">
    <link rel="stylesheet" href="../../../css/my/order/all_orders.css">
</head>

<body style="">
    <div class="aui-content aui-margin-b-15" style="margin-top:0 !important;">
        <ul class="aui-list aui-media-list" id="list_content">
            <!-- <li class="aui-list-item aui-list-item-arrow" onclick="order_details('{{= it[prop]['user_orderid'] }}')">
                <div class="aui-media-list-item-inner">
                    <div class="aui-list-item-inner">
                        <div class="aui-list-item-text aui-ellipsis-1">
                            02月-24日 D312
                        </div>
                        <div class="aui-list-item-text">
                            <div class="aui-list-item-title">广州-太原 16:30-19:15</div>
                            <div class="aui-list-item-right" style="text-align:right;">
                                <e>￥</e>
                                <e1>9101</e1>
                                <div class="aui-list-item-text" style="text-align:right;">
                                    已出售
                                </div>
                            </div>
                        </div>
                        <div class="aui-list-item-text aui-ellipsis-1">
                            动卧
                        </div>
                    </div>
                </div>
            </li> -->
        </ul>
    </div>
</body>

</html>
<!--列表模板 start-->
<script id="allordertpl" type="text/x-dot-template">
    {{ for(var prop = 0;prop< it.length;prop++) { }}
        {{ if (it[prop]['product_id'] == 5 ) { }}
            <li class="aui-list-item aui-list-item-arrow" onclick="order_details('{{= it[prop]['user_orderid'] }}')">
                <div class="aui-media-list-item-inner">
                    <div class="aui-list-item-inner">
                        <div class="aui-list-item-text aui-ellipsis-1">
                            {{= it[prop]['train_date'] }} {{= it[prop]['train_code'] }}
                        </div>
                        <div class="aui-list-item-text">
                            <div class="aui-list-item-title">{{= it[prop]['from_station_name'] }}-{{= it[prop]['to_station_name']}} {{= it[prop]['train_start_time'] }}-{{= it[prop]['train_end_time']}}</div>
                            <div class="aui-list-item-right" style="text-align:right;">
                                <e>￥</e>
                                <e1>{{= it[prop]['order_total_price'] }}</e1>
                                <div class="aui-list-item-text" style="text-align:right;display: block;">
                                    {{= it[prop]['status_text'] }}
                                </div>
                            </div>
                        </div>
                        <div class="aui-list-item-text aui-ellipsis-1">
                            {{= it[prop]['train_seat_type'] }}
                        </div>
                    </div>
                </div>
            </li>
            {{ }else if (it[prop]['product_id'] == 1 ) { }}
            <li class="aui-list-item aui-list-item-arrow" onclick="order_details('{{= it[prop]['user_orderid'] }}')">
                <div class="aui-media-list-item-inner">
                    <div class="aui-list-item-inner">
                        <div class="aui-list-item-text aui-ellipsis-1">
                            {{= it[prop]['take_off_date'] }} {{= it[prop]['flight_number'] }}
                        </div>
                        <div class="aui-list-item-text">
                            <div class="aui-list-item-title">{{= it[prop]['take_off_place'] }}-{{= it[prop]['to_ground_place']}} {{= it[prop]['take_off_time'] }}-{{= it[prop]['to_ground_time']}}</div>
                            <div class="aui-list-item-right" style="text-align:right;">
                                <e>￥</e>
                                <e1>{{= it[prop]['order_total_price'] }}</e1>
                                <div class="aui-list-item-text" style="text-align:right;display: block;">
                                    {{= it[prop]['status_text'] }}
                                </div>
                            </div>
                        </div>
                        <div class="aui-list-item-text aui-ellipsis-1">
                            {{= it[prop]['shipping_space'] }}
                        </div>
                    </div>
                </div>
            </li>
            {{ } else if(it[prop]['product_id'] == 3 ){ }}
            <li class="aui-list-item aui-list-item-arrow" onclick="order_details('{{= it[prop]['user_orderid'] }}')">
                <div class="aui-media-list-item-inner">
                    <div class="aui-list-item-inner">
                        <div class="aui-list-item-title">
                            {{= it[prop]['hotel_name'] }}
                        </div>
                        <div class="aui-list-item-text">
                            <div class="aui-list-item-text">{{= it[prop]['arrival_time'] }}-{{= it[prop]['departure_time']}} </div>
                            <div class="aui-list-item-right" style="text-align:right;">
                                <e>￥</e>
                                <e1>{{= it[prop]['order_total_price'] }}</e1>
                                <div class="aui-list-item-text" style="text-align:right;display: block;">
                                    {{= it[prop]['status_text'] }}
                                </div>
                            </div>
                        </div>
                        <div class="aui-list-item-text aui-ellipsis-1">
                            {{= it[prop]['room_type_name']}} {{= it[prop]['trip_user_count']}}间
                        </div>
                    </div>
                </div>
            </li>
        {{ } }}
    {{ } }}
</script>
<!--列表模板 end-->
<script src="../../../script/aui/api.js"></script>
<script src="../../../script/extend/jquery-3.3.1.min.js"></script>
<script src="../../../script/extend/doT.min.js"></script>
<script src="../../../script/widget/Zepto/dropload.min.js"></script>
<script type="text/javascript" src="../../../script/common.js"></script>
<script src="../../../script/config.js"></script>
<script type="text/javascript">
    //当前页数
    var pageIndex = 0;
    //最大页数
    var maxPage;
    //产品类型
    var productId = 1;
    var container = $("#list_content");
    apiready = function() {
        getOrderItem(true);
        api.parseTapmode();
        //接收监听  订单类型判断
        api.addEventListener({
            name: 'orderEv'
        }, function(ret, err) {
            productId = ret.value.product_id;
            getOrderItem(true);
        });
        //下拉刷新
        push_down(function() {
            getOrderItem(true);
        });
        //上拉加载
        push_up(function() {
            getOrderItem(false);
        });
    }
    function getOrderItem(isFresh) {
        //加载
        if (isFresh) {
            container.empty();
            pageIndex = 1;
        } else {
            pageIndex++;
        }
        var param = {};
        param.url = Config.order.orderLists;
        param.data = {limit : 10,product_id : productId, page : pageIndex};
        if (pageIndex > maxPage) {
          $toast('已滚动到底部',3000);//提示信息
          return false;
        }
        ajax(param, function(ret) {
            if (ret.code == 1) {
                if (ret.data.data.length == 0) {
                  $toast('暂无内容', 3000);
                  return false;
                }
                var dataInter = ret.data.data;
                var interText = doT.template($("#allordertpl").html());
                container.append(interText(dataInter));
                pageIndex = ret.data.current_page;
                maxPage = parseInt(ret.data.last_page);
            } else {
                $toast(ret.msg, 3000);//提示信息
            }
        });
        api.refreshHeaderLoadDone();
    }

    function order_details(order_id) {
        api.openWin({
            name: 'order_details_win',
            url: './order_details_win.html',
            pageParam: {
                user_orderid : order_id
            }
        });
    }
</script>
